<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><meta name=renderer content=webkit><meta name=keywords content=集什商城,集什,得力,采购,办公用品,办公家具,家用电器,采购网,得力文具,办公设备,得力集团,办公耗材,办公用品批发,办公家具采购><meta name=description content=集什商城,专业的政企采购平台,倡导简单、阳光、高效的采购模式。集什商城通过互联网大数据基础及专属营销解决方案，围绕办公用品、工业品、企业定制、节庆福利、积分兑换、弱电系统集成、扶贫公益七大用户场景化的产品需求展开品类构建，为政企提供平台开发、产品供应、电商运营、物流配送及售后服务整体解决方案。>
    <title>集什商城-政企采购专业电商平台,一站式采购服务商城</title>
    <link rel="stylesheet" href="./css/base1.css">
    <link rel="stylesheet" href="./css/regiter.css">
    
</head>
<body>
    <div class="header-h">
        <div class="header">
            <h1 class="logo">
                <a href="">集什商城</a>
            </h1>
            <div class="z-tip f-fl"><p>服务须知：审核时间为2个工作日，遇法定节顺延。</p><p>如有疑问，请拨打服务电话:400-168-0888或联系邮箱:bgsckf@nbdeli.com</p></div>
            <div class="z-right"><span>已有账号?</span ><a href="./view.html" class="zrht">请登录</a></div>
        </div>
        

    </div>
    <div class="ct">
        <div class="constant">
            <div class="z-tab"><p class="z-tab-ber ">注册</p><a href="./view.html" class="z-tab-ship">登录</a></div>
        </div>
        
    </div>

 <div class="lleft">
     <div class="lleft-one">
        <div class="reg-form-group">
            <div class="int">
                <span class="f-fl">用户名</span>
                <input type="text" value="用户名(必须含有字母)" class="to to1">
            </div>
            <p class="ffp">请输入用户名</p></p>
        </div>
        <div class="reg-form-group">
            <div class="int">
                <span class="f-fl">设置密码</span>
                <input type="text" value="建议6-20位字母数字等组合密码" class="to to2">
            </div>
            <p class="ffp">请输入密码</p></p>
        </div>
        <div class="reg-form-group">
            <div class="int">
                <span class="f-fl">确认密码</span>
                <input type="text" value="请输入确认密码" class="to">
            </div>
            <p class="ffp">请输入密码</p></p>
        </div>
        <div class="reg-form-group">
            <div class="int">
                <span class="f-fl">真实姓名</span>
                <input type="text" value="请填写真实姓名" class=" to">
            </div>
            <p class="ffp">请输入密码</p></p>
        </div>
        <div class="reg-form-group">
            <div class="int">
                <span class="f-fl">手机号码</span>
                <input type="text" value="请填写手机号码" class="to">
            </div>
            <p class="ffp">请输入密码</p></p>
        </div>
        <div class="reg-form-group">
            <div class="int">
                <span class="f-fl">验证码</span>
                <input type="text" value="请输入验证码" class="to">
                <span class="yanz">发送短信验证码</span>
            </div>
            <p class="ffp">请输入密码</p></p>
        </div>
        <div class="reg">注册
        </div>
    </div>
    <div class="righ">
        <img src="./imgs/3722.jpg" alt="">
    </div>
 </div>   


        <div class="ebend">
            <div class="b-end">
                <div class="bend"><span>友情链接：</span>
                    <ul class="bend-ul">
                        <li class="bend-lis"><a href="">得力剧团</a></li>
                        <li class="bend-lis"><a href="">得力商城</a></li>
                        <li class="bend-lis"><a href="">集什商城</a></li>
                        <li class="bend-lis"><a href="">企业采购</a></li>
                        <li class="bend-lis"><a href="">办公采购网</a></li>
                        <li class="bend-lis"><a href="">企业办公采购</a></li>
                        <li class="bend-lis"><a href="">办公用品</a></li>
                        <li class="bend-lis"><a href="">办公用品采购</a></li>
                        <li class="bend-lis"><a href="">办公文具采购</a></li>
                        <li class="bend-lis"><a href="">企业办公文具用品</a></li>
                        <li class="bend-lis"><a href="">企业办公采购网</a></li>
                    </ul>
                </div>
                
                <ul class="lend">
                    <li class="lend-li"><a href="">Copyright&nbsp;&copy;&nbsp;2014-2020</a></li>
                    <li class="lend-li"><a href="">集什商城版权所有</a></li>
                    <li class="lend-li">浙ICP备18053989号-1<a href=""></a></li>
                    <li class="lend-li"><a href="">浙公网安备&nbsp;33010402003862号</a></li>
                </ul>
                <br>
                
                <ul class="tend">
                    <li><img src="../www/imgs/001.jpg" alt=""></li>
                    <li><img src="../www/imgs/002.jpg" alt=""></li>
                    <li><img src="../www/imgs/003.jpg" alt=""></li>
                    <li><img src="../www/imgs/004.jpg" alt=""></li>
                    <li><img src="../www/imgs/005.jpg" alt=""></li>
                </ul>
            </div>    
        </div>

<script src="./js/register.js"></script>
<script>
    const oaccount = document.querySelector('.to1');
    const opassword = document.querySelector('.to2');
    const osubmit = document.querySelector(".reg");



osubmit.onclick = function(){
    ajax("http://localhost:3000/api",function(res){
        // console.log(res);
        res = JSON.parse(res);

        if(res.code === 0){
            alert(res.title);
            oaccount.value = "";
            oaccount.focus();
        }else if(res.code === 1){
            if(confirm("注册成功，是否跳转到登录")){
                location.href = "./view.html";
            }
        }
    },{
        type:"register",
        username:oaccount.value,
        password:opassword.value
    })
}


function ajax(url, callback, data){
    let str = "";
    for(let i in data){
        str += `${i}=${data[i]}&`
    }
    url += "?" + str;
    const xhr = new XMLHttpRequest();
    xhr.open("get",url)
    xhr.onload = function(){
        if(xhr.status === 200){
            callback(xhr.responseText)
        }
    }
    xhr.send();
}
</script>
</body>
</html>